#include "summary.h"
#include <stdio.h>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
#include <time.h>

int main(int argc, char **argv) {
	//printf ("starting\n");

	//StreamSummaryBuffer *hs2 = new StreamSummaryBuffer(2,2);
	int k = atoi(argv[1]);
	int n = atoi(argv[2]);
	StreamSummaryBuffer *hs = new StreamSummaryBuffer(k,k);

	clock_t start = clock();

	for (int i = 1; i < n; i++) {
		hs->insert(i%37,i%47, 1.0);

		//hs2->insert(i%37,i%47, (float) 1.0/(i+1));
		//hs->insert(i%17,i%13, 0.3);
	}

	//char * FILENAME = '../../data/zipf_1000000_1.5.in';
	/*int i = 0;
	ifstream file("zipf_1000000_1.5.out");
	string line;
	vector < string > tokens;
	if (file.is_open() ) {
		printf("%s - %d\n", "File opened", (!file.eof()));
		while (!file.eof()) {
			getline(file, line);
			trim(line);
			if (line.size() == 0)
				continue;
			//cerr << line << endl;

			boost::split(tokens, line, boost::is_any_of("\t"));
			//cerr << tokens[0] << "," << tokens[1] << endl;
			(*hs).insert(lexical_cast<int>(tokens[0]),
					lexical_cast<int>(tokens[0]),
					lexical_cast<float>(tokens[1]));
			//cerr << ss.toString() << endl;
			i++;
			tokens.clear();
		}
	} file.close();
*/
	clock_t ends = clock();

	//cerr << "SUMSIZE: " << hs->summarysize() << endl;
	cout << "Running Time : " 	<< (double) (ends - start) / CLOCKS_PER_SEC << endl;
	//cerr << hs->to_string() << endl;
	delete hs;
	//delete hs2;
	//printf("%s", "Finished Program\n");
	return -1;

}
